﻿using System;

namespace SocialNetworkClient.Pages.User
{
    public partial class Home : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Email"] == null || Session["Password"] == null)
            {
                Response.Redirect(@"~/Pages/Error.aspx");
            }

            var userid = Request.QueryString["id"];
            if (string.IsNullOrEmpty(userid))
            {
                privateDiv.Visible = true;
            }
            else
            {
                privateDiv.Visible = (!string.IsNullOrEmpty((string)Session["UserId"]) && userid == (string)Session["UserId"]);

                if (!privateDiv.Visible)
                {
                    groupsLink.HRef = "Groups.aspx?id=" + userid;
                    diaryLink.HRef = "DiaryMessages.aspx?id=" + userid;
                    interestsLink.HRef = "Interests.aspx?id=" + userid;
                }
            }
        }
    }
}